package com.atguigu.aiproject.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@TableName("review_result")
public class ReviewResult {
    // 主键ID
    @TableId(type = IdType.AUTO)
    private Long id;
    // 审核结果核心字段
    @TableField(value = "approved")
    private boolean approved;
    @TableField(value = "reason")
    private String reason;
    @TableField(value = "review_type")
    private String reviewType;
    @TableField(value = "risk_level")
    private String riskLevel;
    @TableField(value = "violation_types")
    private String violationTypes;// 违规类型，以逗号分割
    @TableField(value = "suggestions")
    private String suggestions; // 修改建议，以逗号分割

    // 数据库相关字段
    @TableField(value = "creation_id")
    private int creationId;               // 关联的文章ID
    @TableField(exist = false)
    private String reviewerId;         // 审核员ID（AI审核可设为"AI_SYSTEM"）
    @TableField(value = "review_time",fill = FieldFill.INSERT)
    private LocalDateTime reviewTime;  // 审核时间
    @Version
    private Integer version;           // 版本号（乐观锁）

    // 审核元数据
    @TableField(value = "content_title")
    private String contentTitle;       // 文章标题（冗余存储，便于查询）
    @TableField(value = "content_category")
    private String contentCategory;    // 文章分类
    @TableField(value = "content_keywords")
    private Double confidenceScore;    // 审核置信度（AI审核用）

    // 添加无参构造函数
    public ReviewResult() {
        this.reviewTime = LocalDateTime.now();
        this.reviewerId = "AI_SYSTEM";
    }

    public ReviewResult(boolean approved, String reason, String reviewType) {
        this();
        this.approved = approved;
        this.reason = reason;
        this.reviewType = reviewType;
    }

    // 全参构造器
    public ReviewResult(boolean approved, String reason, String reviewType,
                        String riskLevel, String violationTypes, String suggestions) {
        this(approved, reason, reviewType);
        this.riskLevel = riskLevel;
        this.violationTypes = violationTypes;
        this.suggestions = suggestions;
    }
}